home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
program
/
swagg_m.zip
/
GRAPHICS.SWG
/
0040_Fading.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-11-02
|
1KB
|
77 lines
{ KEVIN OTTO }
Unit Fade;
{ Change DelayAmt and Steps to change the speed of fading. }
Interface
Uses
Dos, Crt;
Const
Colors = 64;
DelayAmt = 15;
Steps = 24;
Type
PalType = Array [0..Colors - 1] of Record
R, G, B : Byte;
end;
Var
OrigPal : palType;
Procedure GetPal(Var OrigPal : PalType);
Procedure FadePal(OrigPal : PalType; FadeOut : Boolean);
Implementation
Procedure GetPal(Var OrigPal : PalType);
Var
Reg : Registers;
begin
With Reg do
begin
AX := $1017;
BX := 0;
CX := colors;
ES := seg(OrigPal);
DX := ofs(OrigPal);
intr ($10, Reg);
end;
end;
Procedure FadePal(OrigPal : PalType; FadeOut : Boolean);
Var
Reg : Registers;
WorkPal : PalType;
Fade : Word;
Pct : Real;
I : Word;
begin
With Reg do
For Fade := 0 to Steps do
begin
Pct := Fade / Steps;
if FadeOut then
Pct := 1 - Pct;
For I := 0 to Colors - 1 do
With WorkPal[I] do
begin
R := round(OrigPal[I].R * Pct);
G := round(OrigPal[I].G * Pct);
B := round(OrigPal[I].B * Pct);
end;
AX := $1012;
BX := 0;
CX := Colors;
ES := seg (WorkPal);
DX := ofs (WorkPal);
intr ($10, Reg);
Delay (DelayAmt);
end;
end;
end.